<?php

/*
 * Clase Persona
 */
class Application_Models_VoluntarioModel 
{
    private $_nombre;
    private $_apellidos;
    private  $_sexo ;
    private  $_email;
    private  $_mes;
    private  $_dia;
    private  $_anio;
    private  $_direccion;
    private  $_ciudad;
    private  $_estado;
    private  $_zip;
    private  $_pais;
    private  $_telefono;
    private  $_contactar;
    private  $_escuchar;
    private  $_emernombre;
    private  $_emerdireccion;
    private  $_emerTelefono;
    private  $_emerEmail;
    private  $_alergias;
    private  $_educacion;
    private  $_colegio;
    private  $_colegioCiudad;
    private  $_colegioEstado;
    private  $_graduacion;
    private  $_mayor;
    private  $_gpa;
    private  $_localizacion;
    private  $_primercombo;
    private  $_segundocombo;
    private  $_programa1;
    private  $_programa2;
    private  $_experiencia;
    private  $_español;
    private  $_intercultural;
    private  $_hobbies;
    private  $_declaracion;
    
    
    public function setNombre( $nombre )
    {
        $this->_nombre = $nombre;
    }
    
    public function getNombre()
    {
        return $this->_nombre;
    }

    public function setApellidos( $apellidos )
    {
        $this->_apellidos = $apellidos;
    }
    
    public function getApellidos()
    {
        return $this->_apellidos;
    }

    public function setSexo( $sexo )
    {
        $this->_sexo = $sexo;
    }
    
    public function getSexo()
    {
        return $this->_sexo;
    }
    
    public function setEmail( $email )
    {
        $this->_email = $email;
    }
    
    public function getEmail()
    {
        return $this->_email;
    }
    
    public function setMes( $mes )
    {
        $this->_mes = $mes;
    }
    
    public function getMes()
    {
        return $this->_mes;
    }
    
    public function setDia( $dia )
    {
        $this->_dia = $dia;
    }
    
    public function getDia()
    {
        return $this->_dia;
    }
    
    public function setAnio( $anio )
    {
        $this->_anio = $anio;
    }
    
    public function getAnio()
    {
        return $this->_anio;
    }
    
    public function setDireccion($direccion)
    {
        $this->_direccion = $direccion;
    }
    
    public function getDireccion()
    {
        return $this->_direccion;
    }
    
    public function setCiudad($ciudad)
    {
        $this->_ciudad = $ciudad;
    }
    
    public function getCiudad()
    {
        return $this->_ciudad;
    }
    
    public function setEstado($estado)
    {
        $this->_estado = $estado;
    }
    
    public function getEstado()
    {
        return $this->_estado;
    }
    
    public function setZip($zip)
    {
        $this->_zip = $zip;
    }
    
    public function getZip()
    {
        return $this->_zip;
    }
    
    public function setPais($pais)
    {
        $this->_pais = $pais;
    }
    
    public function getPais()
    {
        return $this->_pais;
    }
    
    public function setTelefono($telefono)
    {
        $this->_telefono = $telefono;
    }
    
    public function getTelefono()
    {
        return $this->_telefono;
    }
    
    public function setContactar($contactar)
    {
        $this->_contactar = $contactar;
    }
    
    public function getContactar()
    {
        return $this->_contactar;
    }
    
    public function setEscuchar($escuchar)
    {
        $this->_escuchar = $escuchar;
    }
    
    public function getEscuchar()
    {
        return $this->_escuchar;
    }
    
    public function setEmernombre($emernombre)
    {
        $this->_emernombre = $emernombre;
    }
    
    public function getEmernombre()
    {
        return $this->_emernombre;
    }
    
    public function setEmerdireccion($emerdireccion)
    {
        $this->_emerdireccion = $emerdireccion;
    }
    
    public function getEmerdireccion()
    {
        return $this->_emerdireccion;
    }
    
    public function setEmerTelefono($emerTelefono)
    {
        $this->_emerTelefono = $emerTelefono;
    }
    
    public function getEmerTelefono()
    {
        return $this->_emerTelefono;
    }
    
    public function setEmerEmail($emerEmail)
    {
        $this->_emerEmail = $emerEmail;
    }
    
    public function getEmerEmail()
    {
        return $this->_emerEmail;
    }
    
    public function setAlergias($alergias)
    {
        $this->_alergias = $alergias;
    }
    
    public function getAlergias()
    {
        return $this->_alergias;
    }
    
    public function setEducacion($educacion)
    {
        $this->_educacion = $educacion;
    }
    
    public function getEducacion()
    {
        return $this->_educacion;
    }
    
    public function setColegio($colegio)
    {
        $this->_colegio = $colegio;
    }
    
    public function getColegio()
    {
        return $this->_colegio;
    }
    
    public function setColegioCiudad($colegioCiudad)
    {
        $this->_colegioCiudad = $colegioCiudad;
    }
    
    public function getColegioCiudad()
    {
        return $this->_colegioCiudad;
    }
    
    public function setColegioEstado($colegioEstado)
    {
        $this->_colegioEstado = $colegioEstado;
    }
    
    public function getColegioEstado()
    {
        return $this->_colegioEstado;
    }
    
    public function setGraduacion($graduacion)
    {
        $this->_graduacion = $graduacion;
    }
    
    public function getGraduacion()
    {
        return $this->_graduacion;
    }
    
    public function setMayor($mayor)
    {
        $this->_mayor = $mayor;
    }
    
    public function getMayor()
    {
        return $this->_mayor;
    }
    
    public function setGpa($gpa)
    {
        $this->_gpa = $gpa;
    }
    
    public function getGpa()
    {
        return $this->_gpa;
    }
    
    public function setLocalizacion($localizacion)
    {
        $this->_localizacion = $localizacion;
    }
    
    public function getLocalizacion()
    {
        return $this->_localizacion;
    }
    
    public function setPrimercombo($primercombo)
    {
        $this->_primercombo = $primercombo;
    }
    
    public function getPrimercombo()
    {
        return $this->_primercombo;
    }
    
    public function setSegundocombo($segundocombo)
    {
        $this->_segundocombo = $segundocombo;
    }
    
    public function getSegundocombo()
    {
        return $this->_segundocombo;
    }
    
    public function setPrograma1( $programa1 )
    {
        $this->_programa1 = $programa1;
    }
    
    public function getPrograma1()
    {
        return $this->_programa1;
    }
    
    public function setPrograma2( $programa2 )
    {
        $this->_programa2 = $programa2;
    }
    
    public function getPrograma2()
    {
        return $this->_programa2;
    }
    
    
    public function setExperiencia($experiencia)
    {
        $this->_experiencia = $experiencia;
    }
    
    public function getExperiencia()
    {
        return $this->_experiencia;
    }
    
    public function setEspañol($español)
    {
        $this->_español = $español;
    }
    
    public function getEspañol()
    {
        return $this->_español;
    }
    
    public function setIntercultural($intercultural)
    {
        $this->_intercultural = $intercultural;
    }
    
    public function getIntercultural()
    {
        return $this->_intercultural;
    }
    
    public function setHobbies( $hobbies )
    {
        $this->_hobbies = $hobbies;
    }
    
    public function getHobbies()
    {
        return $this->_hobbies;
    }

    public function setDeclaracion($declaracion)
    {
        $this->_declaracion = $declaracion;
    }
    
    public function getDeclaracion()
    {
        return $this->_declaracion;
    }
    
    public function listContactos()       
    {
        
    }
    
    public function insertVoluntario()       
    {
        
       $db = new DataBase();
       $viewVolun = new Application_Views_VoluntarioView();
        $conexion = $db->getConnection();
        $result = $conexion->executeQuery("
            call sp_RegistraVoluntario('".$this->_nombre."','".$this->_apellidos."', ".$this->_sexo.", '".$this->_email."',".$this->_mes.", ".$this->_dia.",".$this->_anio.",
                '".$this->_direccion."', '".$this->_ciudad."', '".$this->_estado."',".$this->_zip.",'".$this->_pais."',".$this->_telefono.",
                '".$this->_contactar."' ,'".$this->_escuchar."' ,'".$this->_emernombre."' ,'".$this->_emerdireccion."' ,".$this->_emerTelefono." ,
                    '".$this->_emerEmail."' ,'".$this->_alergias."' ,'".$this->_educacion."' ,'".$this->_colegio."' ,'".$this->_colegioCiudad."' ,
                '".$this->_colegioEstado."' ,'".$this->_graduacion."' ,'".$this->_mayor."' ,'".$this->_gpa."' ,'".$this->_localizacion."',
                '".$this->_primercombo."' ,'".$this->_segundocombo."' ,'".$this->_programa1."' ,'".$this->_programa2."' ,
                '".$this->_experiencia."' ,'".$this->_español."' ,'".$this->_intercultural."' ,'".$this->_hobbies."' ,'".$this->_declaracion."')" );
    
       
        if( count($result)>0){
            require 'Components/PHPMailer/PHPMailer.php';

            //Create a new PHPMailer instance
            $mail = new PHPMailer();
            //Tell PHPMailer to use SMTP
            $mail->isSMTP();
            //Enable SMTP debugging
            // 0 = off (for production use)
            // 1 = client messages
            // 2 = client and server messages
            $mail->SMTPDebug = 2;
            //Ask for HTML-friendly debug output
            $mail->Debugoutput = 'html';
            //Set the hostname of the mail server
            $mail->Host = 'smtp.gmail.com';
            //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
            $mail->Port = 587;
            //Set the encryption system to use - ssl (deprecated) or tls
            $mail->SMTPSecure = 'tls';
            //Whether to use SMTP authentication
            $mail->SMTPAuth = true;
            //Username to use for SMTP authentication - use full email address for gmail
            $mail->Username = "dxniel27@gmail.com";
            //Password to use for SMTP authentication
            $mail->Password = "Dxasd";
            //Set who the message is to be sent from
            $mail->setFrom('dxniel127@gmail.com', 'admin');
            //Set an alternative reply-to address
            $mail->addReplyTo('dxniel127@gmail.com', 'admin');
            //Set who the message is to be sent to
            $mail->addAddress($this->_email, $this->_nombre);
            $mail->addCC('xrgerx@gmail.com', 'Roger');
            //Set the subject line
            $mail->Subject = 'Ud se a registrado correctamente1';
            //cuerpo
            $mail->Body = 'Ud se a registrado correctamente2';
            //Read an HTML message body from an external file, convert referenced images to embedded,
            //convert HTML into a basic plain-text alternative body
            //--$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
            //Replace the plain text body with one created manually
            $mail->AltBody = 'Ud se a registrado correctamente3';
            //Attach an image file
            //$mail->addAttachment('images/phpmailer_mini.gif');

            //send the message, check for errors
//            if (!$mail->send()) {
//                echo "Mailer Error: " . $mail->ErrorInfo;
//            } else {
//                echo "Message sent!";
//            }
 
           $viewVolun->showMsj();
        }else{
            $viewVolun->showMsjE();
        }
                                                      
        
    }
        
}